package com.aspose.cells;

class zajq {
   private zoz a = null;
   private zpa b;
   private Worksheet c = null;
   private ListObject d = null;

   public ListObject a() {
      return this.d;
   }

   zajq(zpa var1) {
      this.a = var1.m;
      this.b = var1;
      this.c = this.b.d;
   }

   private void b(zcfw var1) throws Exception {
      if (var1.m()) {
         String var2 = var1.a("ref");
         if (var2 != null) {
            CellArea var3 = (CellArea)CellArea.a(var2, true);
            this.d = new ListObject(this.c.getListObjects());
            this.d.a(var3.StartRow);
            this.d.b(var3.StartColumn);
            this.d.c(var3.EndRow);
            this.d.d(var3.EndColumn);
            this.c.getListObjects().a(this.d);
            String var5 = null;
            String var4 = null;

            while(var1.l()) {
               if ("id".equals(var1.p())) {
                  this.d.k(zase.C(var1.s()));
               } else if ("name".equals(var1.p())) {
                  this.d.d(var1.s());
               }

               if ("displayName".equals(var1.p())) {
                  this.d.setDisplayName(var1.s());
               } else if ("comment".equals(var1.p())) {
                  this.d.c(var1.s());
               } else if ("insertRow".equals(var1.p())) {
                  this.d.a(zase.ax(var1.s()));
               } else if ("headerRowCount".equals(var1.p())) {
                  this.d.l(zase.C(var1.s()));
               } else if ("totalsRowCount".equals(var1.p())) {
                  var5 = var1.s();
               } else if ("totalsRowShown".equals(var1.p())) {
                  var4 = var1.s();
               } else if ("published".equals(var1.p())) {
                  this.d.d(zase.ax(var1.s()));
               } else if ("headerRowDxfId".equals(var1.p())) {
                  this.d.h[0] = zase.C(var1.s());
               } else if ("dataDxfId".equals(var1.p())) {
                  this.d.h[1] = zase.C(var1.s());
               } else if ("totalsRowDxfId".equals(var1.p())) {
                  this.d.h[2] = zase.C(var1.s());
               } else if ("tableBorderDxfId".equals(var1.p())) {
                  this.d.h[3] = zase.C(var1.s());
               } else if ("headerRowBorderDxfId".equals(var1.p())) {
                  this.d.h[4] = zase.C(var1.s());
               } else if ("totalsRowBorderDxfId".equals(var1.p())) {
                  this.d.h[5] = zase.C(var1.s());
               } else if ("connectionId".equals(var1.p())) {
                  this.d.j(zase.C(var1.s()));
               } else if ("tableType".equals(var1.p())) {
                  this.d.c = zase.aB(var1.s());
               }
            }

            var1.k();
            if (var5 != null) {
               this.d.m(zase.C(var5));
               if (this.d.A() == 0) {
                  this.d.b(false);
               } else {
                  this.d.b(true);
               }
            }

         } else {
            var1.k();
         }
      }
   }

   void a(zcfw var1) throws Exception {
      this.e(var1);
      this.b(var1);
      if (this.d != null && !var1.n()) {
         var1.d();

         while(var1.r() != 4) {
            var1.j();
            if (var1.r() != 1) {
               var1.a();
            } else if ("autoFilter".equals(var1.p())) {
               zajy.a(var1, this.d.getAutoFilter());
            } else if ("tableColumns".equals(var1.p())) {
               this.d(var1);
            } else if ("tableStyleInfo".equals(var1.p())) {
               this.c(var1);
            } else if ("sortState".equals(var1.p())) {
               zajy.a(var1, this.d.getAutoFilter().getSorter());
            } else {
               var1.a();
            }
         }

      } else {
         var1.a();
      }
   }

   private void c(zcfw var1) throws Exception {
      if (!var1.m()) {
         var1.a();
      } else {
         this.d.setTableStyleName("None");

         while(var1.l()) {
            if ("name".equals(var1.p())) {
               this.d.setTableStyleName(var1.s());
            } else if ("showFirstColumn".equals(var1.p())) {
               this.d.setShowTableStyleFirstColumn(zase.ax(var1.s()));
            } else if ("showLastColumn".equals(var1.p())) {
               this.d.setShowTableStyleLastColumn(zase.ax(var1.s()));
            } else if ("showRowStripes".equals(var1.p())) {
               this.d.setShowTableStyleRowStripes(zase.ax(var1.s()));
            } else if ("showColumnStripes".equals(var1.p())) {
               this.d.setShowTableStyleColumnStripes(zase.ax(var1.s()));
            }
         }

         var1.k();
         var1.a();
      }
   }

   private void d(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         int var2 = 0;
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "tableColumn".equals(var1.p())) {
                  this.a(var1, var2++);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void a(zcfw var1, ListColumn var2) throws Exception {
      if (var1.m()) {
         while(var1.l()) {
            if ("dataDxfId".equals(var1.p())) {
               var2.k[1] = zase.C(var1.s());
            } else if ("uniqueName".equals(var1.p())) {
               var2.c(var1.s());
            } else if ("queryTableFieldId".equals(var1.p())) {
               var2.b(zase.C(var1.s()));
            } else if ("totalsRowFunction".equals(var1.p())) {
               var2.a(zase.aA(var1.s()));
            } else if ("totalsRowLabel".equals(var1.p())) {
               var2.d(var1.s());
            } else if ("headerRowDxfId".equals(var1.p())) {
               var2.k[0] = zase.C(var1.s());
            } else if ("totalsRowDxfId".equals(var1.p())) {
               var2.k[2] = zase.C(var1.s());
            } else if ("id".equals(var1.p())) {
               var2.o = zase.C(var1.s());
            }
         }

         var1.k();
      }
   }

   private void a(zcfw var1, int var2) throws Exception {
      String var3 = var1.a("name");
      if (var3 != null) {
         ListColumn var4 = new ListColumn(this.d.getListColumns(), zase.b(var3), var2);
         this.d.getListColumns().a(var4);
         this.a(var1, var4);
         if (var1.n()) {
            var1.a();
         } else {
            var1.d();

            while(var1.r() != 4) {
               var1.j();
               if (var1.r() != 1) {
                  var1.a();
               } else {
                  String var5;
                  String var6;
                  boolean var7;
                  if ("calculatedColumnFormula".equals(var1.p())) {
                     var5 = var1.a("array");
                     var6 = var1.i();
                     var7 = false;
                     if (var5 != null) {
                        var7 = zase.ax(var5);
                     }

                     var4.b(var6, var7);
                  } else if ("xmlColumnPr".equals(var1.p())) {
                     var4.a = new XmlColumnProperty();
                     var4.a.a = zase.C(var1.a("mapId"));
                     var4.a.b = var1.a("xpath");
                     var4.a.c = var1.a("xmlDataType");
                     var1.a();
                  } else if ("totalsRowFormula".equals(var1.p())) {
                     var5 = var1.a("array");
                     var6 = var1.i();
                     var7 = false;
                     if (var5 != null) {
                        var7 = zase.ax(var5);
                     }

                     var4.a(var6, var7);
                  } else {
                     var1.a();
                  }
               }
            }

            var1.h();
         }
      }
   }

   private void e(zcfw var1) throws Exception {
      var1.j();
      if (var1.r() != 1 || !"table".equals(var1.p())) {
         throw new IllegalStateException("Table root element eror");
      }
   }
}
